package cn.tedu.rabbitmqspringboot.m1;



import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class Main {
    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }
    //定义helloworld队列的参数
    @Bean
    public Queue helloworld(){
//        return new Queue("helloworld");
        return new Queue("helloworld",false);//非持久
    }

    @Autowired
    private Producer producer;
<<<<<<< HEAD
    //在spring扫描完所以有对象，创建完所以实例，并且要完成所有的依赖注入，然后自动执行@PostConstruct 注解的方法
=======

>>>>>>> a0ddcdc6018ffc7262709203f4ba2b928cd8ff15
    @PostConstruct
    public void test(){
        producer.send();
    }

}
